import request from '@/utils/request'

// 创建群聊
export const queryCreateGroup = (params) => {
  return request('POST', '/app/group', params)
}

// 修改群聊头像和名称
export const updateGroupInfo = (params) => {
  return request('PUT', '/app/group', params)
}

// 模块交友创建群聊
export const queryCreateModuleGroup = (params) => {
  return request('POST', '/app/group/add/module', params)
}

// 主动入群
export const joinGroup = (params) => {
  return request('POST', '/app/groupMeb/join', params)
}

let isUpload = {
	list: ''
}
// 群聊通讯录
export const queryGroupList = (params) => {
	if(isUpload.list) {
		isUpload.list.abort()
	}
  return request('GET', '/app/group/list', params,true,false,"加载中", "application/json",true,isUpload)
}

// 分类群聊
export const queryModuleGroupList = (params) => {
  return request('GET', '/app/group/groupModuleList', params)
}

// 群组成员禁言
export const userGag = (params) => {
  return request('POST', '/app/groupMeb/user/gag', params)
}

// 移除群组成员禁言
export const userGagBack = (params) => {
  return request('POST', '/app/groupMeb/user/gag/rollback', params)
}

// 设置管理员
export const setManage = (params) => {
  return request('POST', '/app/groupMeb/user/manage', params)
}

// 设置管理员移除
export const removeManage = (params) => {
  return request('POST', '/app/groupMeb/user/manage/remove', params)
}

// 群组禁言
export const groupGag = (params) => {
  return request('POST', '/app/group/gag', params)
}

// 邀请入群
export const inviteGroup = (params) => {
  return request('POST', '/app/groupMeb/invite', params)
}


// 移除群组禁言
export const groupGagBack = (params) => {
  return request('POST', '/app/group/gag/rollback', params)
}

// 删除群成员/用户退群
export const quitGroup = (params) => {
  return request('DELETE', '/app/groupMeb/quit', params)
}

// 解散群聊
export const dismissGroup = (data) => {
  return request('DELETE', '/app/group/dismiss', data)
}

// 群成员列表
export const queryGroupMemberList = (params) => {
  return request('GET', '/app/groupMeb/list', params)
}

// 群详情
export const queryGroupDetail = (id) => {
  return request('GET', `/app/group/${id}`)
}
